package com.examples.exception;

class MyExceptionE extends Throwable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public MyExceptionE() {
		
		System.out.println("Hello");
		
	}
	public MyExceptionE(String str) {
		
		System.out.println(" cause is "+str);
		
	}
}

 class Divide {

	public int divide (int a,int b) throws MyExceptionE {
	
	
		if( b==0 )
			throw (new MyExceptionE("divide by zero")); 
		else
			return a/b;
	}
	public static void main(String[] args){
		
		Divide obj1 = new Divide();
		
		try {
			obj1.divide(4, 0);
		} catch (MyExceptionE e) {
			System.out.println(" in catch---- exception Occured");
		}
		
	}
}	

